package com.jv.spring.ignore.scan;

import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
@Getter
@Setter
public class IgnoreUser implements /*EnvironmentAware, */ApplicationContextAware {
	@Autowired
	private Environment environment;
	private ApplicationContext applicationContext;

	@Autowired
	private IgnoreDept dept;

	private String name;

	private Integer age;

	public void show(){
		System.out.println(environment.getActiveProfiles());
		System.out.println(applicationContext.getBean(IgnoreDept.class));
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.applicationContext = applicationContext;
	}
}
